package com.hehe.controller;

import com.hehe.powernode.model.Result;
import com.hehe.powernode.pojo.SysRole;
import com.hehe.powernode.pojo.SysUser;
import com.hehe.service.SysRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "系统管理员用户接口管理")
@RestController
@RequestMapping("/sys/role")
@Slf4j
public class SysRoleController {
    @Autowired
    private SysRoleService sysRoleService;
    /**
     * 管理员列表list
     * @return
     */
    @ApiOperation("管理员列表list")
    @GetMapping("/list")
    @PreAuthorize("hasAnyAuthority('sys:role:list')")
    public Result<List<SysRole>> roleList() {
        List<SysRole> list = sysRoleService.list();
        return Result.success(list);
    }
}
